const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    mode: 'development',  //production
    entry: path.join(__dirname, 'src/index.js'),
    output: {
        filename: 'bundle.js',
        path: path.join(__dirname, 'dist')
    },
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          exclude: /(node_modules|bower_components)/,
          use: {
              loader: 'babel-loader',
              options: {
                  presets: ['@babel/preset-env', '@babel/preset-react']
              }
          }
      },
    ]
  },
    plugins: [
      new HtmlWebpackPlugin({
          template: path.join(__dirname, 'src/index.html'),
          filename: 'index.html'
      })
  ],
    devServer: {
      port: 3000,
      contentBase: path.join(__dirname, 'dist')
  }
};